package com.example.imtoken.room.dao

import androidx.room.*
import com.example.imtoken.room.schema.AddressBookSchema

@Dao
interface AddressBookDao {

    @Insert
    fun insertAddressBook(addressBookSchema: AddressBookSchema): Long

    @Query("SELECT * FROM address_book")
    fun findAllAddressBook(): MutableList<AddressBookSchema>

    @Query("SELECT * FROM address_book WHERE id = :id")
    fun findOneAddressBook(id: Int): AddressBookSchema

    @Update
    fun updateAddressBook(addressBookSchema: AddressBookSchema): Int

    @Query("DELETE FROM address_book WHERE id = :id")
    fun deleteAddressBook(id:Int):Int

    @Query("DELETE FROM address_book")
    fun delete(): Int
}